Search systems provide search results in response to receiving search queries. A search system can receive a search query from a mobile computing device, a desktop computer, or a server. Some search systems use various grammar rules to determine the search results. Search systems that use rules may compare the search query with each rule to determine whether the rule applies to the search query. If a particular rule applies to the search query, the search system can retrieve search results that correspond with the rule. Checking for grammar rules can be a computationally intensive endeavor. For example, some search systems represent each grammar rule as a tree and then traverse each tree to determine whether the search query matches the grammar rule. In this example, generating and traversing trees may require extensive computing resources and can take a non-trivial amount of time.